<template>
  <div>
    <span>top头部组件</span>
    <a class="toHomePage" @click="toHomePage">回到首页</a>
  </div>
</template>
<script>
export default {
  name: "top",
  methods: {
    toHomePage() {
      if (this.$route.path != "/homePage") {
        this.$router.push("/homePage");
      }
    },
  },
};
</script>
<style scoped>
.toHomePage {
  display: inline-block;
  width: 6rem;
  height: 2rem;
  line-height: 2rem;
  border: 1px solid rgb(233, 227, 217);
}
</style>
